package com.hxc.common.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DriverManagerDataSource;

/**
 * 数据库配置
 */
@Configuration
public class DataSourceConfig {

  @Value("${spring.datasource.myHana.driver-class-name}")
  private String myHanaDriver;

  @Value("${spring.datasource.myHana.url}")
  private String myHanaUrl;

  @Value("${spring.datasource.myHana.username}")
  private String myHanaUsername;

  @Value("${spring.datasource.myHana.password}")
  private String myHanaPassword;

  // 配置其他数据库连接（待定占位）
  @Bean(name = "HanaDataSource")
  public DriverManagerDataSource HanaDataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName(myHanaDriver);
    dataSource.setUrl(myHanaUrl);
    dataSource.setUsername(myHanaUsername);
    dataSource.setPassword(myHanaPassword);
    return dataSource;
  }
}
